<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  
  <xsl:template name="mime2file">
    <xsl:param name="mimeType"/>
    <xsl:choose>
      <xsl:when test="$mimeType = 'text/plain'">txt</xsl:when>
      <xsl:when test="$mimeType = 'text/html'">html</xsl:when>
      <xsl:when test="$mimeType = 'text/css'">css</xsl:when>
      <xsl:when test="$mimeType = 'image/gif'">gif</xsl:when>
      <xsl:when test="$mimeType = 'image/jpeg'">jpg</xsl:when>
      <xsl:when test="$mimeType = 'image/jpg'">jpg</xsl:when>
      <xsl:when test="$mimeType = 'image/png'">png</xsl:when>
      <xsl:when test="$mimeType = 'text/css'">css</xsl:when>
      <xsl:when test="$mimeType = 'video/avi'">avi</xsl:when>
      <xsl:when test="$mimeType = 'video/mpeg'">mpg</xsl:when>
      <xsl:when test="$mimeType = 'application/pdf'">pdf</xsl:when>
      <xsl:when test="$mimeType = 'application/x-shockwave-flash'">swf</xsl:when>
      <xsl:otherwise>xml</xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  
</xsl:stylesheet>
